namespace topic{
    const R = require('../common/baseController')
    const {getList, getById, save, update} = require('@/service/sys/topicService')
    class TopicController{
        async getList(ctx: any) {
            const listInfo = await getList(ctx)
            ctx.body = R.ok(listInfo)
        }
        async getById (ctx:any) {
            const topicInfo = await getById(ctx)
            ctx.body = R.ok(topicInfo)
        }
        async save(ctx:any) {
            ctx.verifyParams({
                name: {type: 'string', required: true}
            })
            const saveInfo = await save(ctx)
            ctx.body = R.ok(saveInfo)
        }
        async update(ctx:any) {
            ctx.verifyParams({
              name: {type: 'string', required: true},
              avatar_url: {type: 'string', require: false},
              introduction: {type: 'string', require: false}
            })
            const updateInfo = await update(ctx)
            ctx.body = R.ok(updateInfo)
          }
    }
    module.exports = new TopicController()
}